package com.red.star.wechat.data.mappers;

import com.red.star.wechat.data.core.base.MyMapper;
import com.red.star.wechat.data.entity.StatPosterPay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StatPosterPayMapper extends MyMapper<StatPosterPay> {

    List<StatPosterPay> listStatPosterPay(StatPosterPay statPosterPay);

    @Select(value = "select * from stat_poster_pay t where t.order_id = #{orderId} and t.pay_status = 0")
    StatPosterPay findByOrderId(@Param("orderId") String orderId);

    @Select(value = "select * from stat_poster_pay t where t.poster_id = #{posterId} and " +
            "t.fans_id = #{fansId} and t.pay_status = #{payStatus}")
    StatPosterPay findByPosterAFans(@Param("posterId") Integer posterId, @Param("fansId") Integer fansId,
                                    @Param("payStatus") Integer payStatus);

    @Update(value = "update stat_poster_pay set pay_status = #{payStatus} where order_id = #{orderId}")
    Integer updateStatusByOrderId(@Param("orderId") String orderId,@Param("payStatus")Integer payStatus);
}
